<div class="js-response">
	<div class="projectFeeds index">
	<div class="l-curve-top">							
			<div class="r-curve-top">
					<div class="top-bg"></div>
			</div>
						</div>
						<div class="shad-bg-lft clearfix">
							<div class="shad-bg-rgt">
								<div class="shad-bg">
		<div class="main-section js-corner round-5">  
	
	<h2>Voucher</h2>
    
    <?php if(!empty($projectFund['ProjectFund']['is_given'])): ?>
        <h3 class="coupon-used">This voucher has been used</h3>
    <?php endif; ?>
   <div class="clearfix">
	  <table width='100%' cellpadding="5" cellspacing="3" border="0" class="list coupon-expired">
           <tr>
            <th ><?php echo __l('Project name:')?></th>
            <td ><?php echo $this->Html->cText($projectFund['Project']['name']);?></td>
          </tr>
		  <tr>
            <th ><?php echo __l('Coupon code:'); ?></th>
            <td >
               <?php
                  if($projectFund['Project']['project_status_id'] != ConstProjectStatus::Pending && $projectFund['Project']['project_status_id'] != ConstProjectStatus::OpenForFunding && $projectFund['Project']['project_status_id'] != ConstProjectStatus::OpenForIdea)
                  {
                    echo $this->Html->cText($projectFund['ProjectFund']['coupon_code']);
                  }
                  else{
                    echo __l('Project not reached reserve amount. '); 
                  }
               ?>
        </td>
          </tr>		  
          <tr>
            <th ><?php echo __l('Recipient:')?></th>
            <td ><?php echo $this->Html->cText($projectFund['User']['username']);?></td>
          </tr>
          <tr>
            <th ><?php echo __l('Pledge:')?></th>
            <td ><?php echo $this->Html->cDate($projectFund['ProjectFund']['created']);?></td>
          </tr>
          <?php if(!empty($projectFund['ProjectFund']['is_given'])): ?>
          <tr>
            <th ><?php echo __l('Used on:')?></th>
            <td ><?php echo $this->Html->cDate($projectFund['ProjectFund']['modified']);?></td>
          </tr>
          <?php endif; ?>		 
        </table>
    
		<div class="coupon-expired-left">
	      <?php
		      $barcode_width = Configure::read('barcode.width');
			  $barcode_height = Configure::read('barcode.height');
              $parsed_url = parse_url($this->Html->url('/', true));
              $qr_mobile_site_url = str_ireplace($parsed_url['host'], $parsed_url['host'], Router::url(array(
								'controller' => 'deal_user_coupons',
								'action' => 'check_qr',
								$projectFund['ProjectFund']['id'],
								$projectFund['ProjectFund']['unique_coupon_code'],
								'admin' => false
							) , true));
                            
		  ?>
		  <img src="http://chart.apis.google.com/chart?cht=qr&chs=<?php echo $barcode_width; ?>x<?php echo $barcode_height; ?>&chl=<?php echo $qr_mobile_site_url ?>" alt = "[Image: Project qr code]"/>
		<p>
		  <?php echo $projectFund['ProjectFund']['unique_coupon_code'] ?>
		  </p>
		  </div>
		  </div>
		  <?php
                  if($projectFund['Project']['project_status_id'] != ConstProjectStatus::Pending && $projectFund['Project']['project_status_id'] != ConstProjectStatus::OpenForFunding && $projectFund['Project']['project_status_id'] != ConstProjectStatus::OpenForIdea && $projectFund['Project']['user_id'] == $this->Auth->user('id'))
                  {
          ?>
	<div class="clearfix">
	   <?php
	      if(empty($projectFund['ProjectFund']['is_given'])):
			   echo $this->Form->create('ProjectFund', array( 'action'=> 'check_qr', 'class' => 'normal clearfix'));			  
			   echo $this->Form->input('coupon_code', array('type'=>'hidden'));
			   echo $this->Form->input('unique_coupon_code', array('type'=>'hidden'));
			   echo $this->Form->submit(__l('Mark as Given'));
			   echo $this->Form->end();            
		  endif;
	   ?>
</div>
   <?PHP } ?>
</div>
	</div>
			</div>
							</div>
						</div>
						<div class="l-curve-bot">							
							<div class="r-curve-bot">
								<div class="bot-bg"></div>
							</div>
						</div>
	</div>